package com.wulis.seckill.business.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.wulis.seckill.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@Accessors(chain = true)
@ApiModel(description = "用户信息")
public class UserInfo extends BaseEntity {

    @ApiModelProperty("用户ID")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("用户名")
    @JsonSerialize(using = ToStringSerializer.class)
    private String name;

    @ApiModelProperty("账号")
    @JsonSerialize(using = ToStringSerializer.class)
    private String account;

    @ApiModelProperty("密码")
    @JsonSerialize(using = ToStringSerializer.class)
    private String password;

    @ApiModelProperty("手机号码")
    @JsonSerialize(using = ToStringSerializer.class)
    private String phone;

    @ApiModelProperty("登录次数")
    @JsonSerialize(using = ToStringSerializer.class)
    private Integer loginCount;

    @ApiModelProperty("过期时间")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long expireTime;

    @ApiModelProperty("最后登录时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime lastLoginTime;

}
